<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title></title>
  <script src="https://cdn.bootcss.com/react/16.4.0/umd/react.development.js"></script>
  <script src="https://cdn.bootcss.com/react-dom/16.4.0/umd/react-dom.development.js"></script>
  <script src="https://cdn.bootcss.com/babel-standalone/6.26.0/babel.min.js"></script>
</head>

<body>
  <div id="root">

  </div>
</body>

</html>

<script type="text/babel">
    class Demo extends React.Component {
        constructor(props) {
            super(props);
            this.toDetail = this.toDetail.bind(this);
        }

    toDetail(id) {
        console.log(event);
        alert(id);
    }

    render() {
        return (
            <div>
                <ul>
                    <li> <button onClick={() => {this.toDetail(1001)}}>电影1</button> </li>
                    <li> <button onClick={() => {this.toDetail(1002)}}>电影2</button> </li>
                    <li> <button onClick={() => {this.toDetail(1003)}}>电影3</button> </li>
                </ul>
            </div>
        )
    }
}

ReactDOM.render(
    <Demo />,
    document.getElementById('root')
)
</script>